import 'package:flutter/foundation.dart';//状态模型

class CounterModel extends ChangeNotifier{
  int _count = 0;
  String _theme = "light";
  int get count => _count;
  String get theme =>_theme;

  void increment(){
    _count++;
    notifyListeners(); // 通知监听者更新
  }

  void reset(){
    _count = 0;
    notifyListeners();
  }

  void toggleTheme(){
    _theme = _theme == "light" ? "dark" :"light";
    notifyListeners();
  }
}
